.class public Lcom/opongo/blogapp/adapter/ViewPagerAdapter;
.super Landroid/support/v4/view/PagerAdapter;
.source "ViewPagerAdapter.java"

# interfaces
.implements Lcom/viewpagerindicator/TitleProvider;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/opongo/blogapp/adapter/ViewPagerAdapter$PostWorker;,
        Lcom/opongo/blogapp/adapter/ViewPagerAdapter$UpdateAdapter;,
        Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;
    }
.end annotation


# static fields
.field public static final DEBUG:Z

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private DESC:[Ljava/lang/Boolean;

.field private activity:Landroid/app/Activity;

.field private apiManager:Lcom/opongo/blogapp/manager/APIManager;

.field private final context:Landroid/content/Context;

.field protected dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

.field private es:Ljava/util/concurrent/ExecutorService;

.field private footerViewLoading:Landroid/view/View;

.field private mAdapterArray:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/opongo/blogapp/adapter/PostListAdapter;",
            ">;"
        }
    .end annotation
.end field

.field private order:[Ljava/lang/String;

.field protected positionInDetailView:I

.field protected post_id:I

.field protected query:Ljava/lang/String;

.field protected queryLimit:I

.field private scrollPosition:[I

.field private titles:[Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 41
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->DEBUG:Z

    .line 42
    const-class v0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->TAG:Ljava/lang/String;

    .line 39
    return-void
.end method

.method public constructor <init>(Landroid/app/Activity;Landroid/content/Context;Lcom/opongo/blogapp/manager/DatabaseManager;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Boolean;)V
    .locals 3
    .parameter "activity"
    .parameter "context"
    .parameter "dbManager"
    .parameter "query"
    .parameter "titles"
    .parameter "order"
    .parameter "DESC"

    .prologue
    const/4 v2, 0x0

    .line 73
    invoke-direct {p0}, Landroid/support/v4/view/PagerAdapter;-><init>()V

    .line 53
    const/16 v1, 0x14

    iput v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->queryLimit:I

    .line 55
    iput v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->post_id:I

    .line 56
    iput v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->positionInDetailView:I

    .line 62
    const/4 v1, 0x1

    invoke-static {v1}, Ljava/util/concurrent/Executors;->newFixedThreadPool(I)Ljava/util/concurrent/ExecutorService;

    move-result-object v1

    iput-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->es:Ljava/util/concurrent/ExecutorService;

    .line 77
    iput-object p2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->context:Landroid/content/Context;

    .line 78
    iput-object p1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    .line 79
    iput-object p3, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 80
    iput-object p4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->query:Ljava/lang/String;

    .line 81
    new-instance v1, Lcom/opongo/blogapp/manager/APIManager;

    invoke-direct {v1, p2}, Lcom/opongo/blogapp/manager/APIManager;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->apiManager:Lcom/opongo/blogapp/manager/APIManager;

    .line 82
    iput-object p5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->titles:[Ljava/lang/String;

    .line 83
    array-length v1, p5

    new-array v1, v1, [I

    iput-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->scrollPosition:[I

    .line 84
    iput-object p6, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->order:[Ljava/lang/String;

    .line 85
    iput-object p7, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->DESC:[Ljava/lang/Boolean;

    .line 87
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    array-length v1, p5

    if-lt v0, v1, :cond_0

    .line 91
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    iput-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    .line 114
    return-void

    .line 88
    :cond_0
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->scrollPosition:[I

    aput v2, v1, v0

    .line 87
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 3
    .parameter "context"

    .prologue
    const/4 v2, 0x0

    .line 66
    invoke-direct {p0}, Landroid/support/v4/view/PagerAdapter;-><init>()V

    .line 53
    const/16 v1, 0x14

    iput v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->queryLimit:I

    .line 55
    iput v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->post_id:I

    .line 56
    iput v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->positionInDetailView:I

    .line 62
    const/4 v1, 0x1

    invoke-static {v1}, Ljava/util/concurrent/Executors;->newFixedThreadPool(I)Ljava/util/concurrent/ExecutorService;

    move-result-object v1

    iput-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->es:Ljava/util/concurrent/ExecutorService;

    .line 67
    iput-object p1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->context:Landroid/content/Context;

    .line 68
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->titles:[Ljava/lang/String;

    array-length v1, v1

    if-lt v0, v1, :cond_0

    .line 71
    return-void

    .line 69
    :cond_0
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->scrollPosition:[I

    aput v2, v1, v0

    .line 68
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method static synthetic access$0(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Ljava/util/ArrayList;
    .locals 1
    .parameter

    .prologue
    .line 58
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    return-object v0
.end method

.method static synthetic access$1(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)[Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 45
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->order:[Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$10(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)[I
    .locals 1
    .parameter

    .prologue
    .line 47
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->scrollPosition:[I

    return-object v0
.end method

.method static synthetic access$2(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)[Ljava/lang/Boolean;
    .locals 1
    .parameter

    .prologue
    .line 64
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->DESC:[Ljava/lang/Boolean;

    return-object v0
.end method

.method static synthetic access$3(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Landroid/app/Activity;
    .locals 1
    .parameter

    .prologue
    .line 60
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    return-object v0
.end method

.method static synthetic access$4()Ljava/lang/String;
    .locals 1

    .prologue
    .line 42
    sget-object v0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$5(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 279
    invoke-direct {p0, p1}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->addFooterLoadMore(I)V

    return-void
.end method

.method static synthetic access$6(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Landroid/content/Context;
    .locals 1
    .parameter

    .prologue
    .line 46
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->context:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$7(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Lcom/opongo/blogapp/manager/APIManager;
    .locals 1
    .parameter

    .prologue
    .line 50
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->apiManager:Lcom/opongo/blogapp/manager/APIManager;

    return-object v0
.end method

.method static synthetic access$8(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Ljava/util/concurrent/ExecutorService;
    .locals 1
    .parameter

    .prologue
    .line 62
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->es:Ljava/util/concurrent/ExecutorService;

    return-object v0
.end method

.method static synthetic access$9(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Landroid/view/View;
    .locals 1
    .parameter

    .prologue
    .line 52
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->footerViewLoading:Landroid/view/View;

    return-object v0
.end method

.method private addFooterLoadMore(I)V
    .locals 6
    .parameter "p"

    .prologue
    const/4 v5, 0x0

    .line 280
    iget-object v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v2, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/opongo/blogapp/adapter/PostListAdapter;

    .line 282
    .local v1, mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    iget-object v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    .line 283
    const-string v3, "layout_inflater"

    invoke-virtual {v2, v3}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v2

    .line 282
    check-cast v2, Landroid/view/LayoutInflater;

    .line 284
    const v3, 0x7f03000b

    const/4 v4, 0x0

    .line 283
    invoke-virtual {v2, v3, v5, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v0

    .line 285
    .local v0, footerView:Landroid/view/View;
    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v2}, Landroid/view/View;->setTag(Ljava/lang/Object;)V

    .line 287
    invoke-virtual {v1}, Lcom/opongo/blogapp/adapter/PostListAdapter;->removeListViewFooter()V

    .line 288
    invoke-virtual {v1, v0, v5}, Lcom/opongo/blogapp/adapter/PostListAdapter;->setListViewFooter(Landroid/view/View;Landroid/widget/ListView;)V

    .line 290
    new-instance v2, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$4;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$4;-><init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)V

    invoke-virtual {v0, v2}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 308
    return-void
.end method


# virtual methods
.method public destroyItem(Landroid/view/View;ILjava/lang/Object;)V
    .locals 2
    .parameter "pager"
    .parameter "p"
    .parameter "view"

    .prologue
    .line 240
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v1, p2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/opongo/blogapp/adapter/PostListAdapter;

    .line 241
    .local v0, mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    const/4 v1, 0x0

    iput-object v1, v0, Lcom/opongo/blogapp/adapter/PostListAdapter;->listView:Landroid/widget/ListView;

    .line 243
    check-cast p1, Landroid/support/v4/view/ViewPager;

    .end local p1
    check-cast p3, Landroid/widget/ListView;

    .end local p3
    invoke-virtual {p1, p3}, Landroid/support/v4/view/ViewPager;->removeView(Landroid/view/View;)V

    .line 244
    return-void
.end method

.method protected doRefresh(ZI)V
    .locals 13
    .parameter "forceRefresh"
    .parameter "p"

    .prologue
    const/4 v12, 0x0

    const/4 v10, 0x0

    const/4 v11, 0x1

    .line 564
    iget-object v8, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v8}, Ljava/util/ArrayList;->size()I

    move-result v8

    if-le v8, p2, :cond_1

    .line 565
    iget-object v8, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v8, p2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lcom/opongo/blogapp/adapter/PostListAdapter;

    .line 567
    .local v5, mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    iget-wide v2, v5, Lcom/opongo/blogapp/adapter/PostListAdapter;->lastrefresh:J

    .line 568
    .local v2, last_registerUser:J
    new-instance v8, Ljava/util/Date;

    invoke-direct {v8}, Ljava/util/Date;-><init>()V

    invoke-virtual {v8}, Ljava/util/Date;->getTime()J

    move-result-wide v6

    .line 570
    .local v6, now:J
    const-wide/32 v8, 0x493e0

    sub-long v8, v6, v8

    cmp-long v8, v2, v8

    if-ltz v8, :cond_0

    if-eqz p1, :cond_2

    .line 571
    :cond_0
    iget-boolean v8, v5, Lcom/opongo/blogapp/adapter/PostListAdapter;->isLockLoading:Z

    if-nez v8, :cond_2

    .line 573
    iput-boolean v11, v5, Lcom/opongo/blogapp/adapter/PostListAdapter;->isLockLoading:Z

    .line 574
    iput-wide v6, v5, Lcom/opongo/blogapp/adapter/PostListAdapter;->lastrefresh:J

    .line 577
    :try_start_0
    iget-object v4, v5, Lcom/opongo/blogapp/adapter/PostListAdapter;->listView:Landroid/widget/ListView;

    check-cast v4, Leu/erikw/PullToRefreshListView;

    .line 578
    .local v4, listview:Leu/erikw/PullToRefreshListView;
    invoke-virtual {v4}, Leu/erikw/PullToRefreshListView;->isRefreshing()Z
    :try_end_0
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_0

    .line 583
    .end local v4           #listview:Leu/erikw/PullToRefreshListView;
    :goto_0
    sget-object v8, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->TAG:Ljava/lang/String;

    const-string v9, "doRefresh"

    invoke-static {v8, v9}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 585
    new-instance v8, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;

    invoke-direct {v8, p0, v10}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;-><init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;)V

    const/4 v9, 0x2

    new-array v9, v9, [Ljava/lang/Integer;

    invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v10

    aput-object v10, v9, v12

    invoke-static {v11}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v10

    aput-object v10, v9, v11

    invoke-virtual {v8, v9}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 600
    .end local v2           #last_registerUser:J
    .end local v5           #mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    .end local v6           #now:J
    :cond_1
    :goto_1
    return-void

    .line 579
    .restart local v2       #last_registerUser:J
    .restart local v5       #mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    .restart local v6       #now:J
    :catch_0
    move-exception v0

    .line 580
    .local v0, e:Ljava/lang/NullPointerException;
    invoke-virtual {v0}, Ljava/lang/NullPointerException;->printStackTrace()V

    goto :goto_0

    .line 588
    .end local v0           #e:Ljava/lang/NullPointerException;
    :cond_2
    sget-object v8, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->TAG:Ljava/lang/String;

    const-string v9, "doRefresh locked"

    invoke-static {v8, v9}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 590
    invoke-virtual {v5}, Lcom/opongo/blogapp/adapter/PostListAdapter;->removeListViewHeader()V

    .line 592
    invoke-virtual {v5}, Lcom/opongo/blogapp/adapter/PostListAdapter;->isEmpty()Z

    move-result v8

    if-eqz v8, :cond_1

    .line 593
    iget-object v8, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    .line 594
    const-string v9, "layout_inflater"

    invoke-virtual {v8, v9}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v8

    .line 593
    check-cast v8, Landroid/view/LayoutInflater;

    .line 595
    const v9, 0x7f03000c

    invoke-virtual {v8, v9, v10, v12}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v1

    .line 596
    .local v1, footerView:Landroid/view/View;
    invoke-virtual {v5, v1, v10}, Lcom/opongo/blogapp/adapter/PostListAdapter;->setListViewFooter(Landroid/view/View;Landroid/widget/ListView;)V

    goto :goto_1
.end method

.method public doRefresh(ZII)V
    .locals 1
    .parameter "forceRefresh"
    .parameter "p"
    .parameter "post_id"

    .prologue
    .line 559
    iput p3, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->post_id:I

    .line 560
    const/4 v0, 0x1

    invoke-virtual {p0, v0, p2}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->doRefresh(ZI)V

    .line 561
    return-void
.end method

.method public doRefreshAll()V
    .locals 9

    .prologue
    const/4 v8, 0x0

    .line 537
    const/4 v3, 0x0

    .local v3, i:I
    :goto_0
    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->titles:[Ljava/lang/String;

    array-length v5, v5

    if-lt v3, v5, :cond_0

    .line 556
    return-void

    .line 538
    :cond_0
    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v5}, Ljava/util/ArrayList;->size()I

    move-result v5

    if-le v5, v3, :cond_1

    .line 539
    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v5, v3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/opongo/blogapp/adapter/PostListAdapter;

    .line 541
    .local v4, mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    invoke-virtual {v4}, Lcom/opongo/blogapp/adapter/PostListAdapter;->getCursor()Landroid/database/Cursor;

    move-result-object v0

    .line 542
    .local v0, currentcursor:Landroid/database/Cursor;
    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    invoke-virtual {v5, v0}, Landroid/app/Activity;->stopManagingCursor(Landroid/database/Cursor;)V

    .line 544
    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "SELECT * FROM "

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v7, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v7}, Lcom/opongo/blogapp/manager/DatabaseManager;->getTableName()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, " WHERE id = 0"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 545
    .local v1, cursor:Landroid/database/Cursor;
    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    invoke-virtual {v5, v1}, Landroid/app/Activity;->startManagingCursor(Landroid/database/Cursor;)V

    .line 546
    invoke-virtual {v4, v1}, Lcom/opongo/blogapp/adapter/PostListAdapter;->changeCursor(Landroid/database/Cursor;)V

    .line 548
    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    .line 549
    const-string v6, "layout_inflater"

    invoke-virtual {v5, v6}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v5

    .line 548
    check-cast v5, Landroid/view/LayoutInflater;

    .line 550
    const v6, 0x7f03000e

    const/4 v7, 0x0

    invoke-virtual {v5, v6, v8, v7}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v2

    .line 551
    .local v2, footerView:Landroid/view/View;
    invoke-virtual {v4, v2, v8}, Lcom/opongo/blogapp/adapter/PostListAdapter;->setListViewFooter(Landroid/view/View;Landroid/widget/ListView;)V

    .line 552
    const-wide/16 v5, 0x0

    iput-wide v5, v4, Lcom/opongo/blogapp/adapter/PostListAdapter;->lastrefresh:J

    .line 553
    const/4 v5, 0x1

    invoke-virtual {p0, v5, v3}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->doRefresh(ZI)V

    .line 537
    .end local v0           #currentcursor:Landroid/database/Cursor;
    .end local v1           #cursor:Landroid/database/Cursor;
    .end local v2           #footerView:Landroid/view/View;
    .end local v4           #mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    :cond_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_0
.end method

.method public finishUpdate(Landroid/view/View;)V
    .locals 0
    .parameter "view"

    .prologue
    .line 254
    return-void
.end method

.method public getCount()I
    .locals 1

    .prologue
    .line 122
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->titles:[Ljava/lang/String;

    array-length v0, v0

    return v0
.end method

.method public getTitle(I)Ljava/lang/String;
    .locals 1
    .parameter "position"

    .prologue
    .line 117
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->titles:[Ljava/lang/String;

    aget-object v0, v0, p1

    return-object v0
.end method

.method public instantiateItem(Landroid/view/View;I)Ljava/lang/Object;
    .locals 13
    .parameter "pager"
    .parameter "p"

    .prologue
    .line 128
    const/4 v12, 0x0

    .line 131
    .local v12, v:Leu/erikw/PullToRefreshListView;
    const/4 v0, 0x0

    .line 133
    .local v0, mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    iget-object v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->getTableName()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2, p2}, Lcom/opongo/blogapp/manager/DatabaseManager;->queryForBlogTypeID(Ljava/lang/String;I)I

    move-result v6

    .line 136
    .local v6, blogTypeID:I
    iget-object v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->query:Ljava/lang/String;

    const/4 v1, 0x3

    new-array v3, v1, [Ljava/lang/Object;

    const/4 v1, 0x0

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    aput-object v5, v3, v1

    const/4 v1, 0x1

    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->order:[Ljava/lang/String;

    aget-object v5, v5, p2

    aput-object v5, v3, v1

    const/4 v5, 0x2

    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->DESC:[Ljava/lang/Boolean;

    aget-object v1, v1, p2

    invoke-virtual {v1}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v1

    if-eqz v1, :cond_1

    const-string v1, "DESC"

    :goto_0
    aput-object v1, v3, v5

    invoke-static {v2, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v11

    .line 138
    .local v11, queryFormat:Ljava/lang/String;
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v1, v11}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v4

    .line 139
    .local v4, cursor:Landroid/database/Cursor;
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    invoke-virtual {v1, v4}, Landroid/app/Activity;->startManagingCursor(Landroid/database/Cursor;)V

    .line 141
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    if-le v1, p2, :cond_2

    .line 142
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v1, p2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    .end local v0           #mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    check-cast v0, Lcom/opongo/blogapp/adapter/PostListAdapter;

    .line 144
    .restart local v0       #mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    invoke-virtual {v0}, Lcom/opongo/blogapp/adapter/PostListAdapter;->getCursor()Landroid/database/Cursor;

    move-result-object v7

    .line 145
    .local v7, currentcursor:Landroid/database/Cursor;
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    invoke-virtual {v1, v7}, Landroid/app/Activity;->stopManagingCursor(Landroid/database/Cursor;)V

    .line 147
    invoke-virtual {v0, v4}, Lcom/opongo/blogapp/adapter/PostListAdapter;->changeCursor(Landroid/database/Cursor;)V

    .line 154
    .end local v7           #currentcursor:Landroid/database/Cursor;
    :goto_1
    iget-object v1, v0, Lcom/opongo/blogapp/adapter/PostListAdapter;->listView:Landroid/widget/ListView;

    if-nez v1, :cond_3

    .line 155
    new-instance v10, Leu/erikw/PullToRefreshListView;

    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    invoke-direct {v10, v1}, Leu/erikw/PullToRefreshListView;-><init>(Landroid/content/Context;)V

    .line 157
    .local v10, listView:Leu/erikw/PullToRefreshListView;
    new-instance v1, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$1;

    invoke-direct {v1, p0, p2}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$1;-><init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;I)V

    invoke-virtual {v10, v1}, Leu/erikw/PullToRefreshListView;->setOnRefreshListener(Leu/erikw/PullToRefreshListView$OnRefreshListener;)V

    .line 164
    iput-object v10, v0, Lcom/opongo/blogapp/adapter/PostListAdapter;->listView:Landroid/widget/ListView;

    .line 165
    move-object v12, v10

    .line 170
    .end local v10           #listView:Leu/erikw/PullToRefreshListView;
    :goto_2
    invoke-virtual {v0}, Lcom/opongo/blogapp/adapter/PostListAdapter;->isEmpty()Z

    move-result v1

    if-eqz v1, :cond_4

    .line 171
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    .line 172
    const-string v2, "layout_inflater"

    invoke-virtual {v1, v2}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    .line 171
    check-cast v1, Landroid/view/LayoutInflater;

    .line 173
    const v2, 0x7f03000d

    const/4 v3, 0x0

    const/4 v5, 0x0

    invoke-virtual {v1, v2, v3, v5}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v8

    .line 174
    .local v8, footerView:Landroid/view/View;
    const/4 v1, 0x0

    invoke-virtual {v0, v8, v1}, Lcom/opongo/blogapp/adapter/PostListAdapter;->setListViewFooter(Landroid/view/View;Landroid/widget/ListView;)V

    .line 187
    .end local v8           #footerView:Landroid/view/View;
    :cond_0
    :goto_3
    invoke-virtual {v12, v0}, Leu/erikw/PullToRefreshListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 189
    new-instance v1, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;

    invoke-direct {v1, p0, p2}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;-><init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;I)V

    invoke-virtual {v12, v1}, Leu/erikw/PullToRefreshListView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 219
    const/4 v1, 0x0

    invoke-virtual {p0, v1, p2}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->doRefresh(ZI)V

    .line 221
    check-cast p1, Landroid/support/v4/view/ViewPager;

    .end local p1
    const/4 v1, 0x0

    invoke-virtual {p1, v12, v1}, Landroid/support/v4/view/ViewPager;->addView(Landroid/view/View;I)V

    .line 223
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->scrollPosition:[I

    aget v1, v1, p2

    invoke-virtual {v12, v1}, Leu/erikw/PullToRefreshListView;->setSelection(I)V

    .line 225
    new-instance v1, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$3;

    invoke-direct {v1, p0, p2}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$3;-><init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;I)V

    invoke-virtual {v12, v1}, Leu/erikw/PullToRefreshListView;->setOnScrollListener(Landroid/widget/AbsListView$OnScrollListener;)V

    .line 235
    return-object v12

    .line 136
    .end local v4           #cursor:Landroid/database/Cursor;
    .end local v11           #queryFormat:Ljava/lang/String;
    .restart local p1
    :cond_1
    const-string v1, "ASC"

    goto/16 :goto_0

    .line 149
    .restart local v4       #cursor:Landroid/database/Cursor;
    .restart local v11       #queryFormat:Ljava/lang/String;
    :cond_2
    new-instance v0, Lcom/opongo/blogapp/adapter/PostListAdapter;

    .end local v0           #mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    iget-object v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    .line 150
    const v3, 0x7f03000f

    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v5}, Lcom/opongo/blogapp/manager/DatabaseManager;->getTableName()Ljava/lang/String;

    move-result-object v5

    .line 149
    invoke-direct/range {v0 .. v5}, Lcom/opongo/blogapp/adapter/PostListAdapter;-><init>(Landroid/app/Activity;Landroid/content/Context;ILandroid/database/Cursor;Ljava/lang/String;)V

    .line 151
    .restart local v0       #mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v1, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_1

    .line 167
    :cond_3
    iget-object v12, v0, Lcom/opongo/blogapp/adapter/PostListAdapter;->listView:Landroid/widget/ListView;

    .end local v12           #v:Leu/erikw/PullToRefreshListView;
    check-cast v12, Leu/erikw/PullToRefreshListView;

    .restart local v12       #v:Leu/erikw/PullToRefreshListView;
    goto :goto_2

    .line 176
    :cond_4
    iget-object v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;

    .line 177
    const-string v2, "layout_inflater"

    invoke-virtual {v1, v2}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    .line 176
    check-cast v1, Landroid/view/LayoutInflater;

    .line 178
    const v2, 0x7f03000e

    const/4 v3, 0x0

    const/4 v5, 0x0

    invoke-virtual {v1, v2, v3, v5}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v9

    .line 179
    .local v9, header:Landroid/view/View;
    const/4 v1, 0x0

    invoke-virtual {v0, v9, v1}, Lcom/opongo/blogapp/adapter/PostListAdapter;->setListViewHeader(Landroid/view/View;Landroid/widget/ListView;)V

    .line 180
    iget-object v1, v0, Lcom/opongo/blogapp/adapter/PostListAdapter;->listView:Landroid/widget/ListView;

    invoke-virtual {v1, v0}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 182
    iget-boolean v1, v0, Lcom/opongo/blogapp/adapter/PostListAdapter;->lastpage:Z

    if-nez v1, :cond_0

    .line 183
    invoke-direct {p0, p2}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->addFooterLoadMore(I)V

    goto :goto_3
.end method

.method public isViewFromObject(Landroid/view/View;Ljava/lang/Object;)Z
    .locals 1
    .parameter "view"
    .parameter "object"

    .prologue
    .line 248
    invoke-virtual {p1, p2}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public restoreState(Landroid/os/Parcelable;Ljava/lang/ClassLoader;)V
    .locals 5
    .parameter "p"
    .parameter "c"

    .prologue
    .line 258
    instance-of v2, p1, Lcom/opongo/blogapp/utils/ScrollState;

    if-eqz v2, :cond_0

    .line 259
    check-cast p1, Lcom/opongo/blogapp/utils/ScrollState;

    .end local p1
    invoke-virtual {p1}, Lcom/opongo/blogapp/utils/ScrollState;->getScrollPos()[I

    move-result-object v2

    iput-object v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->scrollPosition:[I

    .line 262
    :cond_0
    iget-object v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_1
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_2

    .line 267
    return-void

    .line 262
    :cond_2
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/opongo/blogapp/adapter/PostListAdapter;

    .line 263
    .local v0, adapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    iget-object v3, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;

    invoke-virtual {v3, v0}, Ljava/util/ArrayList;->indexOf(Ljava/lang/Object;)I

    move-result v1

    .line 264
    .local v1, pos:I
    iget-object v3, v0, Lcom/opongo/blogapp/adapter/PostListAdapter;->listView:Landroid/widget/ListView;

    if-eqz v3, :cond_1

    .line 265
    iget-object v3, v0, Lcom/opongo/blogapp/adapter/PostListAdapter;->listView:Landroid/widget/ListView;

    iget-object v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->scrollPosition:[I

    aget v4, v4, v1

    invoke-virtual {v3, v4}, Landroid/widget/ListView;->setSelection(I)V

    goto :goto_0
.end method

.method public saveState()Landroid/os/Parcelable;
    .locals 2

    .prologue
    .line 271
    new-instance v1, Lcom/opongo/blogapp/utils/ScrollState;

    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->scrollPosition:[I

    invoke-virtual {v0}, [I->clone()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [I

    invoke-direct {v1, v0}, Lcom/opongo/blogapp/utils/ScrollState;-><init>([I)V

    return-object v1
.end method

.method public startUpdate(Landroid/view/View;)V
    .locals 0
    .parameter "view"

    .prologue
    .line 277
    return-void
.end method
